﻿using System;
using System.Collections.Generic;
using System.Text;
using FingerTip.Infrastructure.MongoDb;
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;

namespace FingerTip.UnitTest.MongoDb.Entity
{
    public class MongoDbEntityBase:IMongoDbEntityBase
    {
        [BsonId]
        public ObjectId Id { get; set; }

        [BsonDateTimeOptions(Kind = DateTimeKind.Local)]
        [BsonIgnore]
        public DateTime CreateTime
        {
            get
            {
                return DateTime.Parse(Id.CreationTime.ToLocalTime().ToString());
            }
        }
        /// <summary>
        ///  Id字符串
        /// </summary>
        /// <returns></returns>
        [BsonIgnore]
        public string _Id
        {
            get
            {
                return Id.ToString();
            }
        }
    }
}
